import Mock from 'mockjs'

export const loginMock = (url: string) => {
  Mock.mock(new RegExp(url), {
    code: 200,
    message: 'ok',
    body: {
      userId: '@id',
      userAccount: '@name',
      userName: '@cname',
      token: '@guid'
    }
  })
}

export const getUserInfoMock = (url: string) => {
  Mock.mock(new RegExp(url), {
    code: 200,
    message: 'ok',
    body: {
      userId: '@id',
      userAccount: '@name',
      userName: '@cname',
      token: '@guid'
    }
  })
}

export const getUserMenuMock = (url: string) => {
  Mock.mock(new RegExp(url), {
    code: 200,
    message: 'ok',
    body: [{
      label: '仪表盘',
      name: 'DashBoard',
      url: '/dashboard',
      icon: 'DashboardOutlined',
      hide: false,
      operations: []
    }, {
      label: '系统设置',
      name: 'SystemSettings',
      url: null,
      icon: 'SettingOutlined',
      hide: false,
      operations: [],
      children: [{
        label: '用户管理',
        name: 'UserManage',
        url: '/settings/user-manage',
        icon: '',
        hide: false,
        operations: ['add', 'edit', 'delete']
      }, {
        label: '权限管理',
        name: 'AuthManage',
        url: '/settings/auth-manage',
        icon: '',
        hide: false,
        operations: ['add', 'edit', 'delete']
      }]
    }]
  })
}
